# coding=utf-8
from datetime import timedelta

import logging
from redis import StrictRedis

#基类配置信息
class Config(object):

    SECRET_KEY = 'fffffffff'
    DEBUG = True

    #数据库配置
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1:3306/info36'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    #redis配置
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    #session配置信息
    SESSION_TYPE = 'redis' #设置ｓｅｓｓｉｏｎ存储类型
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)#指定session存储的ｒｅｄｉｓ服务器
    SESSION_USE_SIGNER = True #设置签名存储
    PERMANENT_SESSION_LIFETIME = timedelta(days=2) #设置session有效期

    #默认日志级别
    LEVEL_NAME = logging.DEBUG

#开发环境配置信息
class DevelopConfig(Config):
    pass
#生产(线上)环境配置信息
class ProductConfig(Config):
    DEBUG = False
    LEVE_NAME = logging.ERROR
#测试环境配置信息
class TestConfig(Config):
    pass


#提供一个统一的访问入口
config_dict ={
    'develop':DevelopConfig,
    'product':ProductConfig,
    'test':TestConfig
}